﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DTOFrameworks;
using System.Data;
using System.Xml;
using FooFun.DataElements.Dtos;

namespace DTOFrameworks
{
    public class Topic
    {
        public Topic(DataRow row)
        {
            topicId = (int)row["TopicId"];

            this.ForumId = (int)row["ForumId"];

            string content = (string)row["Content"];

            XmlDocument doc = new XmlDocument();
            doc.LoadXml(content);

            XmlElementDataElement de
                = new XmlElementDataElement(doc.DocumentElement);
            this.dataElement = de;
        }

        public Topic(IDataElement de)
        {
            this.dataElement = de;
        }

        int topicId;

        public int TopicId
        {
            get { return topicId; }
            set { topicId = value; }
        }

        public int ForumId { get; set; }

        IDataElement dataElement;

        public IDataElement DataElement
        {
            get { return dataElement; }
        }
    }
}
